<template>
    <div>
      <card-container  key="container3"  style="margin-top: 16px" :title="rightConTitle" >
        <blog-card  :isMy="true" v-if="rightList.length>0" v-for="(val,index) in rightList" :key="val.blogId" :info="val"></blog-card>
        <empty-card v-if="rightList.length===0" height="556px"></empty-card>

      </card-container>
      <pagination key="container5" style="margin:20px auto;" :pages="pages" v-on:listenPageChange="changePage"></pagination>
    </div>
</template>


<script>
  import BlogCard from '../../../components/pc/projectCard';
  import CardContainer from '../../../components/pc/cardContainer';
  import config from '../../../action/config';
  import Pagination from "../../../components/pc/pagination";
  import EmptyCard from "../../../components/pc/emptyCard";

  export default {
    name:'blog',
    data(){
      return{
        rightConType:1,
        leftList:[],
        rightList:[],
        pages:1,
      }
    },
    computed:{
      rightConTitle(){
          return '我的博客'
      },
    },
    components:{
      BlogCard,CardContainer,Pagination,EmptyCard
    },

    methods:{
      dataGetBlog(currentPage){

          this.$axios.$get(config.api.get.Blog.myList, {
            params: {
              page: currentPage,
              size: 10
            }
          }).then((response) => {
            this.rightList = response.data.dataList;
            this.pages = response.data.totalPage;
          })

      },

      changePage(currentPage){
        //返回页数 请求新的数据
        this.dataGetBlog(currentPage);
      }
    },
  }
</script>
